home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Sample Code / Snippets / Development Tools & Languages / Shared Lib. Mgr. C++ / Sources / TestTool.cp < prev    next >
Encoding:
Text File  |  1992-08-30  |  2.0 KB  |  69 lines  |  [TEXT/MPS ]

  1. /* _________________________________________________________________________________________________________ //
  2.   Copyright © 1992 Apple Computer, Inc. All rights reserved.
  3.   Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework.
  4.   Date: Wednesday, August 10, 1992 22:37:30
  5.   Revision comments are at the end of this file.
  6.   ---
  7.   TProcess is a Process Manager class.
  8.   TestTool.cp contains the class body information for testing the TProcess class.
  9.   _________________________________________________________________________________________________________ */
  10.  
  11.  
  12. #include "Process.h"
  13.  
  14. #ifndef __LIBRARYMANAGERUTILITIES__
  15. #include <LibraryManagerUtilities.h>
  16. #endif
  17.  
  18. #include <iostream.h>
  19.  
  20.  
  21. main()
  22. {
  23.     // Prologue.
  24.     InitLibraryManager();                        // Initialize the SLM
  25.  
  26.     TLibraryManager * testMgr = GetLocalLibraryManager();// Get pointer to the TLibraryManager
  27.  
  28.     if (testMgr == NULL)
  29.     {
  30.         cout << "Couldn't get a TLibraryManager\n" << endl;
  31.         return 1;
  32.     }
  33.  
  34.     testMgr->TraceLogOn();                        // turn on the trace
  35.  
  36.     // Test phase.
  37.     cout << "Start TProcess testing!\n" << endl;
  38.  
  39.     // Get our TProcess object from SLM.
  40.     TProcess * myProcess = (TProcess *)testMgr->NewObject(kTProcessID);
  41.     if (!myProcess)
  42.         cout << "Could not create new object!!!\n" << endl;
  43.  
  44.  
  45.     myProcess->Initialize();                    // initialize with current Process
  46.     cout << "First test, the current process\n" << endl;
  47.     cout << "We have just now " << myProcess->GetNumProcesses() << " processes running." << endl;
  48.     cout << "This process has " << myProcess->GetFreeMem() << " memory free." << endl;
  49.  
  50.  
  51.     cout << "Final test, try to find a process with signature 'MACS' (Finder) " << endl;
  52.     TProcess * findProc = new TProcess;
  53.     if (findProc->FindProcess('MACS'))
  54.         cout << " Finder Process found!" << endl;
  55.  
  56.     // Epilogue.
  57.     CleanupLibraryManager();
  58.     return 0;
  59. }
  60.  
  61.  
  62. // _________________________________________________________________________________________________________ //
  63.  
  64. /*    Change History (most recent last):
  65.   No        Init.    Date        Comment
  66.   1            khs        8/10/92        New file, SLM support
  67. */
  68.  
  69.